package com.treasure.web.service;

import com.treasure.web.command.response.SystemUploadResponse;
import lombok.RequiredArgsConstructor;
import org.springframework.stereotype.Service;
import org.springframework.web.multipart.MultipartFile;

import java.io.IOException;

/**
 * @author sunhongmin
 * @date 2024/1/13 18:00
 * @description
 */
@Service
@RequiredArgsConstructor
public class FileUploadService {
    private final LocalFileRepository localFileRepository;

    public SystemUploadResponse fileUpload(MultipartFile file) throws IOException {
        String fileUrl = localFileRepository.uploadFileStore(file, "corpLogo");
        return new SystemUploadResponse(fileUrl);
    }
}
